package com.dxg.msns.common.pojo;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * 音乐实体类
 * 对应数据库表：music
 * 
 * @author system
 */
@Table(name = "music")
public class Music implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 音乐ID
     */
    @Column(name = "music_id")
    private String musicId;

    /**
     * 音乐封面
     */
    @Column(name = "music_cover_url")
    private String musicCoverUrl;

    /**
     * 音乐名
     */
    @Column(name = "music_name")
    private String musicName;

    /**
     * 音乐作者
     */
    @Column(name = "music_author")
    private String musicAuthor;

    /**
     * 专辑名称
     */
    @Column(name = "music_album")
    private String musicAlbum;

    /**
     * 音乐发布日期
     */
    @Column(name = "music_publis_date")
    private String musicPublisDate;

    /**
     * 音乐上传日期
     */
    @Column(name = "music_push_date")
    private Date musicPushDate;

    /**
     * 音乐时长
     */
    @Column(name = "music_length")
    private String musicLength;

    /**
     * 音乐类型
     */
    @Column(name = "music_type_id")
    private Integer musicTypeId;

    /**
     * 音乐文件路径
     */
    @Column(name = "music_url")
    private String musicUrl;

    /**
     * 状态
     */
    @Column(name = "status")
    private String status;

    /**
     * 平均得分
     */
    @Column(name = "music_averge_grade")
    private String musicAvergeGrade;

    /**
     * 歌词
     */
    @Column(name = "lyric")
    private String lyric;

    // 构造方法
    public Music() {
    }

    public Music(String musicId, String musicName, String musicAuthor) {
        this.musicId = musicId;
        this.musicName = musicName;
        this.musicAuthor = musicAuthor;
        this.musicPushDate = new Date();
        this.status = "1";
    }

    // Getter 和 Setter 方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getMusicId() {
        return musicId;
    }

    public void setMusicId(String musicId) {
        this.musicId = musicId;
    }

    public String getMusicCoverUrl() {
        return musicCoverUrl;
    }

    public void setMusicCoverUrl(String musicCoverUrl) {
        this.musicCoverUrl = musicCoverUrl;
    }

    public String getMusicName() {
        return musicName;
    }

    public void setMusicName(String musicName) {
        this.musicName = musicName;
    }

    public String getMusicAuthor() {
        return musicAuthor;
    }

    public void setMusicAuthor(String musicAuthor) {
        this.musicAuthor = musicAuthor;
    }

    public String getMusicAlbum() {
        return musicAlbum;
    }

    public void setMusicAlbum(String musicAlbum) {
        this.musicAlbum = musicAlbum;
    }

    public String getMusicPublisDate() {
        return musicPublisDate;
    }

    public void setMusicPublisDate(String musicPublisDate) {
        this.musicPublisDate = musicPublisDate;
    }

    public Date getMusicPushDate() {
        return musicPushDate;
    }

    public void setMusicPushDate(Date musicPushDate) {
        this.musicPushDate = musicPushDate;
    }

    public String getMusicLength() {
        return musicLength;
    }

    public void setMusicLength(String musicLength) {
        this.musicLength = musicLength;
    }

    public Integer getMusicTypeId() {
        return musicTypeId;
    }

    public void setMusicTypeId(Integer musicTypeId) {
        this.musicTypeId = musicTypeId;
    }

    public String getMusicUrl() {
        return musicUrl;
    }

    public void setMusicUrl(String musicUrl) {
        this.musicUrl = musicUrl;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMusicAvergeGrade() {
        return musicAvergeGrade;
    }

    public void setMusicAvergeGrade(String musicAvergeGrade) {
        this.musicAvergeGrade = musicAvergeGrade;
    }

    public String getLyric() {
        return lyric;
    }

    public void setLyric(String lyric) {
        this.lyric = lyric;
    }

    @Override
    public String toString() {
        return "Music{" +
                "id=" + id +
                ", musicId='" + musicId + '\'' +
                ", musicCoverUrl='" + musicCoverUrl + '\'' +
                ", musicName='" + musicName + '\'' +
                ", musicAuthor='" + musicAuthor + '\'' +
                ", musicAlbum='" + musicAlbum + '\'' +
                ", musicPublisDate='" + musicPublisDate + '\'' +
                ", musicPushDate=" + musicPushDate +
                ", musicLength='" + musicLength + '\'' +
                ", musicTypeId=" + musicTypeId +
                ", musicUrl='" + musicUrl + '\'' +
                ", status='" + status + '\'' +
                ", musicAvergeGrade='" + musicAvergeGrade + '\'' +
                ", lyric='" + lyric + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        Music music = (Music) o;

        return musicId != null ? musicId.equals(music.musicId) : music.musicId == null;
    }

    @Override
    public int hashCode() {
        return musicId != null ? musicId.hashCode() : 0;
    }
}